<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户位置分布</title>
</head>

<!-- 引入刚刚下载的 ECharts 文件 -->
<script src="/js/echarts.min.js"></script>
<!-- jquery.js -->
<script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>

<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main" style="width: 600px;height:400px;"></div>
</body>

<script>

    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);

    option = {
        tooltip: {
            trigger: 'item'
        },
        legend: {
            top: '5%',
            left: 'center'
        },
        series: [
            {
                name: 'Access From',
                type: 'pie',
                radius: ['40%', '70%'],
                avoidLabelOverlap: false,
                itemStyle: {
                    borderRadius: 10,
                    borderColor: '#fff',
                    borderWidth: 2
                },
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '40',
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    // { value: 1048, name: 'Search Engine' },
                    // { value: 735, name: 'Direct' },
                    // { value: 580, name: 'Email' },
                    // { value: 484, name: 'Union Ads' },
                    // { value: 300, name: 'Video Ads' }
                ]
            }
        ]
    };

    //myChart.setOption(option);
    //发送ajax
    $.get("/user/getUserAddressDto",
        function(userAddressDto){
            alert("userAddressDto：" + userAddressDto)
            //赋值
            option.series[0].data = userAddressDto;

            //配置
            myChart.setOption(option);
        });

</script>

</html>